package com.liugui.vueblog.bean;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;

/**
 * @ClassName: R
 * @Author: liugui
 * @Date: 2020-07-22 17:11
 **/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(fluent = true)
public class R<T> implements Serializable {

    private String status;
    private String code;
    private T data;

    public R<T> success(String code,T data){
        this.status = "success";
        this.code = code;
        this.data = data;
        return this;
    }

    public R<T> error(String code){
        this.status = "error";
        this.code = code;
        return this;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
}
